home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Demos / Widget / Wvscale.stklos < prev    next >
Encoding:
Text File  |  1995-09-13  |  1.3 KB  |  31 lines

  1. ;;;;
  2. ;;;; STk adaptation of the Tk widget demo.
  3. ;;;;
  4. ;;;; This demonstration script shows an example with a vertical scale.
  5. ;;;;
  6.  
  7. (define (demo-vscale)
  8.   
  9.   (define (set-height! c poly line height)
  10.     (let* ((height (+ height 21))
  11.        (y2     (max (- height 30) 21)))
  12.       (set! (coords poly) (list 15 20 35 20 35 y2 45 y2 25 height 5 y2 15 y2 15 20))
  13.       (set! (coords line) (list 15 20 35 20 35 y2 45 y2 25 height 5 y2 15 y2 15 20))))
  14.  
  15.   (let* ((w (make-demo-toplevel  "vscale"
  16.                  "Vertical Scale Demonstration"
  17.                  "An arrow and a vertical scale are displayed below.  If you click or drag mouse button 1 in the scale, you can change the size of the arrow."))
  18.      (f    (make <Frame> :parent w :border-width 10))
  19.      (c    (make <Canvas> :parent f :width 50 :height 50 :border-width 0 
  20.              :highlight-thickness 0))
  21.      (poly  (make <Polygon> :parent c :coords '(0 0 1 1 2 2) :fill "SeaGreen3"))
  22.      (line  (make <Line> :parent c :coords '(0 0 1 1 2 2 0 0) :fill "black"))
  23.      (s     (make <Scale> :parent f :orientation "vertical" :scale-length 284 
  24.               :from 0 :to 250
  25.               :tick-interval 50 :value 75
  26.               :command (lambda (v) (set-height! c poly line v)))))
  27.     
  28.     (pack f)
  29.     (pack s :side "left" :anchor "ne")
  30.     (pack c :side "left" :anchor "nw" :fill "y")))
  31.